package com.jsd2412.backend.turnBed.controller;

import com.jsd2412.backend.base.response.JsonResult;
import com.jsd2412.backend.turnBed.pojo.dto.TurnBedAddParam;
import com.jsd2412.backend.turnBed.pojo.dto.TurnBedQuery;
import com.jsd2412.backend.turnBed.pojo.vo.TurnBedVO;
import com.jsd2412.backend.turnBed.service.TurnBedService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@Api(tags = "转床管理")
@RequestMapping("/v1/turnBed/")
public class TurnBedController {
    @Autowired
    private TurnBedService turnBedService;

    @PostMapping("add")
    public JsonResult addTurnBed(TurnBedAddParam turnBedAddParam) {
        log.debug("添加转床记录:{}", turnBedAddParam);
        turnBedService.addTurnBed(turnBedAddParam);
        return JsonResult.ok();
    }

    @GetMapping("select")
    public JsonResult selectTurnBed(TurnBedQuery turnBedQuery) {
        log.debug("查询转床记录：{}", turnBedQuery);
        List<TurnBedVO> list = turnBedService.selectTurnBed(turnBedQuery);
        return JsonResult.ok(list);
    }
}
